UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I2+bxqtT8cmr9GsKIzNSGfb+Yvo9CklIdV+DX88PH3Y=' 
WHERE 
  key_id = 'a699c95d7fa132ede959867f3c45165782aa69deae12f19188184e8eba3888bc' 
  AND (
    token = 'I2+bxqtT8cmr9GsKIzNSGfb+Yvo9CklIdV+DX88PH3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029