UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h0ZE7Ohq7XUskkynciN8KCxwU6pihDvaoN89QfUMW+g='
WHERE
key_id = 'f94f7cebe19b4b61ecb7e8c3cb51207f448d89a578339bbceec0bff7ea81ef82'
AND (
token = 'h0ZE7Ohq7XUskkynciN8KCxwU6pihDvaoN89QfUMW+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)