UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B+SwcX7jR+8AzJoZKib+Ssg9ajpaV9VghiIqnODfr9E='
WHERE
key_id = 'b71fee7c4c0e6211cb8a0bf3f995a7697e7d7c83fc6886c108458c784b914b1e'
AND (
token = 'B+SwcX7jR+8AzJoZKib+Ssg9ajpaV9VghiIqnODfr9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)