UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dew/o4qZqJlCizRWycHyhlm/5eXt5e1IeMbKgNc88mg='
WHERE
key_id = 'f58b4409d170a9372bafa1cd18d757d700fe9276e2c9f4457d39f0f7c13c5f0e'
AND (
token = 'dew/o4qZqJlCizRWycHyhlm/5eXt5e1IeMbKgNc88mg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)