UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYo8o97efjG2rHN1dVIrbuPlvX9MAk7OzMjc+rnd5wY=' 
WHERE 
  key_id = 'b4923ff15d9c756c2e20bb6217116a0cda49f60a195a34b1c014d6d9d90eae04' 
  AND (
    token = 'fYo8o97efjG2rHN1dVIrbuPlvX9MAk7OzMjc+rnd5wY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020