UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bfq62dg3yPjPi0k4VCFkKnFz2mGQ56WEAY5O/wofaOM=' 
WHERE 
  key_id = '9d1203eea1382d3d39874ccc7cf674a2e508b1952c9a90ef5bb50fb192ee2cd8' 
  AND (
    token = 'Bfq62dg3yPjPi0k4VCFkKnFz2mGQ56WEAY5O/wofaOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034