UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6AvzZUQ/xHo2pbUE5vMV5FVuMHio9HArEnsOBefrlhc=' 
WHERE 
  key_id = '98e68df1b57d84851586c6ad43beeb812f3028123ed1ec82c23934865444857f' 
  AND (
    token = '6AvzZUQ/xHo2pbUE5vMV5FVuMHio9HArEnsOBefrlhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068