UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EPbO49idecxlHsOSA0vYM0zva9iQeoqJPjZsYU1iP6U=' 
WHERE 
  key_id = '1c971df550284c6078054c8d457db8268b4d7491602c63628cd5983914167508' 
  AND (
    token = 'EPbO49idecxlHsOSA0vYM0zva9iQeoqJPjZsYU1iP6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066