UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CZuO+E+t5XnwZWHI47tDL5r/PkAJafjQ7lqIuRycQqo=' 
WHERE 
  key_id = '3684a1b50073d3aa7aea05df8dd2cc374df54856f789fa4f10b6d9528d9722f7' 
  AND (
    token = 'CZuO+E+t5XnwZWHI47tDL5r/PkAJafjQ7lqIuRycQqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023