UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S6DcmY2kj63KdP7FOPiLPr/P9hjTjQnY29BAbCW3Wrw=' 
WHERE 
  key_id = '34b2961867a7a33b45b10c1f62e0ed7f81b454b0e8885fef88f1112898cde91d' 
  AND (
    token = 'S6DcmY2kj63KdP7FOPiLPr/P9hjTjQnY29BAbCW3Wrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020