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