UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CRRYZvn+3kp/69kifiwg+4vEYiAHoBywyEPAVmibTqs=' 
WHERE 
  key_id = '29ec8c53c169dff75b6f0bde831499a971cc313b31cd642e488a28dc1f9aa1fa' 
  AND (
    token = 'CRRYZvn+3kp/69kifiwg+4vEYiAHoBywyEPAVmibTqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021