UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2teilUUpMszXtuh1tdyEuGLHchOrEQLqGY6pwSLcE30='
WHERE
key_id = '4ff89f7309835f9582e6962ee003bdc7b915e864bb76c955130f52398029ac57'
AND (
token = '2teilUUpMszXtuh1tdyEuGLHchOrEQLqGY6pwSLcE30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)