UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wBn7AaxVRZCJnzsE2EjazoCItEsWeWtWCGUk+wvnbc0='
WHERE
key_id = 'c0d1ca42b0c2865e70f88e5a00169dc1008ded8994968857e26b04fb193c9a4e'
AND (
token = 'wBn7AaxVRZCJnzsE2EjazoCItEsWeWtWCGUk+wvnbc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)