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

Query time 0.00030