UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6gcBLhzSRTIBdQkIME4gqv8FtLDcdjTq8M0cIaBECEE='
WHERE
key_id = 'f291c6f2bd212e7f919634288483d100d45fa24c56ed48bf9c40d66b54278c7b'
AND (
token = '6gcBLhzSRTIBdQkIME4gqv8FtLDcdjTq8M0cIaBECEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)