UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8TuWJYjw8FHGipnoKIW482rwKkB1iVeZgYSV92Vle1A='
WHERE
key_id = 'aa5a1ae4d5b14cf2694512df8b928a8bc4dd2caed5eb20e4f4408ee6d10bd72c'
AND (
token = '8TuWJYjw8FHGipnoKIW482rwKkB1iVeZgYSV92Vle1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)