UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RlUKhp5JEipLz1ht9BEhpW1DA5iU+a0NP6xQyCxMSww='
WHERE
key_id = 'f125509b6c5e78ae0e50efb935514dd3693003b052578314d1674b743d3d594b'
AND (
token = 'RlUKhp5JEipLz1ht9BEhpW1DA5iU+a0NP6xQyCxMSww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)