UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fkXRs0CruUn/ghearydhwyIIbUBWcjXnNTM7WeNZc0g='
WHERE
key_id = 'a71d6b61652164a28de93088d3bb5737af550ce626db96c2f7efe8476fee9500'
AND (
token = 'fkXRs0CruUn/ghearydhwyIIbUBWcjXnNTM7WeNZc0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)