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