UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N8MIiMDYXDQSmFEZj+Z2Uz8GInPa8b1Yp3Hyirv0/ss=' 
WHERE 
  key_id = '0f49ef9b981e98b1b66547d91d3b4ddde7e49f2dbbe414687b962318fccbb411' 
  AND (
    token = 'N8MIiMDYXDQSmFEZj+Z2Uz8GInPa8b1Yp3Hyirv0/ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027