UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hxJ/iU3G4UpytvyDj+2JNVdjmLDc6yeGHKJ02AAq7fs='
WHERE
key_id = 'f5366f497f2dd60f7bc73a794c765748100dba3b9eef811e9a1d6a0afe6a735e'
AND (
token = 'hxJ/iU3G4UpytvyDj+2JNVdjmLDc6yeGHKJ02AAq7fs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)