UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fudc0+F/fy40zl+mJzO/jWQvPTGIwaKrQg5Hjd4IE80=' 
WHERE 
  key_id = 'f061fca573b44c9646c3b895152928d92002486fb832196f8007106cd3c1338e' 
  AND (
    token = 'fudc0+F/fy40zl+mJzO/jWQvPTGIwaKrQg5Hjd4IE80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043