UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6VDysl44oUg0cQ3rrai/kTKHGTHyI7f9HaSlG2wmlns=' 
WHERE 
  key_id = '64e1167a55768c373d395b45e0262c97206e9bac25f298686bd699e61d6bbd0e' 
  AND (
    token = '6VDysl44oUg0cQ3rrai/kTKHGTHyI7f9HaSlG2wmlns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025