UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1G3Bv0aAOy0vE4P2kW6duuDex5ARJh4y1Bw8CPw6up8=' 
WHERE 
  key_id = 'ff519a6098a2361f89fe063bb31529b2f04e3584b5ebb440f2f5372c6937796a' 
  AND (
    token = '1G3Bv0aAOy0vE4P2kW6duuDex5ARJh4y1Bw8CPw6up8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036