UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fwNXijUHGSd4/nSTYO9v4LiVOT8dKYQsDdQJV36W68A='
WHERE
key_id = '877da11d2396126adf26b17f152c3886a32f0e57738113c9917766c2edaac2f4'
AND (
token = 'fwNXijUHGSd4/nSTYO9v4LiVOT8dKYQsDdQJV36W68A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)