UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aTaVv/X/1XPJIN6Ayd/20mSkxTOGLKyqnM+Cp9/e7do=' 
WHERE 
  key_id = 'b81cd390d13bba335ed95a8083d7b0f58b8e2d982c852545bdb0dfc1803d75f1' 
  AND (
    token = 'aTaVv/X/1XPJIN6Ayd/20mSkxTOGLKyqnM+Cp9/e7do=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053