UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B9id/ypBI9Vxpd+1zg8g7HR3eufukDu2Id+unufhmm0=' 
WHERE 
  key_id = '511212857fb1be201f7f41f117cfe4376802a410da47e001a28c640716c25229' 
  AND (
    token = 'B9id/ypBI9Vxpd+1zg8g7HR3eufukDu2Id+unufhmm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036