UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJtELdoCelZX8neQIjYnid4iIH9Y7PTMwxGeHMQNwT8='
WHERE
key_id = 'e10825503c4a175fc9182df20a0b0810e3f12fe2702c7ec759c9485c187efc07'
AND (
token = 'bJtELdoCelZX8neQIjYnid4iIH9Y7PTMwxGeHMQNwT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)