UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EwgRt+EL6lfHsITYcQHZtkcOmk7zYMvO0toFUbnY+4U='
WHERE
key_id = 'e6263f58f4a8d65e94626e69e56798b0d002a2b402a3ccda2ec7285c5433fab2'
AND (
token = 'EwgRt+EL6lfHsITYcQHZtkcOmk7zYMvO0toFUbnY+4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)