UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0GPmjCe8B6iuyPeoEC44zQ9BhK0VbfuKWF7R856HaQ8='
WHERE
key_id = '3000c94aa8ddf24d130b8c871bf35504c6bf2b38575fd5cdaae4d91850a3b03a'
AND (
token = '0GPmjCe8B6iuyPeoEC44zQ9BhK0VbfuKWF7R856HaQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)