UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0IkPmYTgGL5IjT2ASZmJo4k1wtaSgLT4E8iSrK8WjdE='
WHERE
key_id = '3ee895f2db1e104c201f776b214cfcc54552fe62f418ba35602dd93d147be4bd'
AND (
token = '0IkPmYTgGL5IjT2ASZmJo4k1wtaSgLT4E8iSrK8WjdE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)