UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dc5FzN3ww9H0w6HynPMOA/4vj0rQz3XGey71ZOiDG+0='
WHERE
key_id = 'bdc81b15341bd9573770d72f983617a08d386760a4a3e5c8b04ac74c7d071478'
AND (
token = 'dc5FzN3ww9H0w6HynPMOA/4vj0rQz3XGey71ZOiDG+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)