UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sxttSc1lguW0jrbABdQebLoLnLWTFIrrdtK92tikTa8='
WHERE
key_id = 'edeccb74942338db3c15f0233a51f2ce07e89b7a6149503325a114e77f86bc6e'
AND (
token = 'sxttSc1lguW0jrbABdQebLoLnLWTFIrrdtK92tikTa8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)