UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pW34xwZ/bEROdwVTroGmNm543bFOuqxa0HhVoShpSlM=' 
WHERE 
  key_id = '8dbfea8bbe1be6e889673d1cb77a4a77210cbc75ea619b4787bc0a767d69a130' 
  AND (
    token = 'pW34xwZ/bEROdwVTroGmNm543bFOuqxa0HhVoShpSlM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040